<?php
//Nguyen Van Binh
//suongmumc@gmail.com

defined( '_VALID_NVB' ) or die( 'Direct Access to this location is not allowed.' );
$tpl = new TemplatePower("template/footer.htm");
$tpl->prepare();
$tpl->assignGlobal("site_address", $site_address);

// menu bottom
$sql="SELECT * FROM menu".$lang." WHERE active=1  ORDER BY thu_tu ASC, name ASC";
$db=$DB->query($sql);

while($rs=mysql_fetch_array($db)){
	if(in_array('menufooter',setvitri($rs['id_menu']))){
		$tpl->newBlock("menufooter");		
		$tpl->assign("name",$rs['name']);	
		$tpl->assign("link",$site_address.$rs['link_write']);
		
	}
}

		$sql="SELECT * FROM catlg WHERE active=1 AND postion='advbottom' ORDER BY thu_tu DESC, name ASC";
		$db=$DB->query($sql);
		while($rs=mysql_fetch_array($db)){
			$sql1="SELECT * FROM logo WHERE active=1 AND id_catlg IN(".Get_Id_CatLG($rs['id_catlg']).") ORDER BY thu_tu DESC, name ASC";
			$db1=$DB->query($sql1);
			while($rs1=mysql_fetch_array($db1)){
				$tpl->newBlock("advbottom");
				if ($rs1['image']){
					$tpl->assign("imageadv","<img alt='".clean_url($rs1['name'])."' src='".$site_address.$CONFIG['upload_image_path'].$rs1['image']."' border='0'  width='150' height='108'>");
				}
				$tpl->assign("link",$rs1['link']);
				$tpl->assign("target",$rs1['target']);
			}
		}	
$sql="SELECT * FROM static WHERE active=1 AND inwhere='infooter' ORDER BY thu_tu DESC, id_static DESC LIMIT 0,1";
$db=$DB->query($sql);
if($rs=mysql_fetch_array($db)){
	$tpl->assignGlobal("footer",$rs['content'])	;
}

//users online
require("lib/usersonline.php");
$visitors_online = new usersOnline; 
$info['useronline']=$visitors_online->count_users();
$tpl->assignGlobal("online" , $info['useronline']);

//counter
include('lib/counter.php');
$tpl->assignGlobal('today',$counter['today']);
$tpl->assignGlobal('yesterday', intval($counter['yesterday']));
$tpl->assignGlobal('visited',$counter['total']);

$tpl->printToScreen();


?>